<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:76:"D:\Code\matian\matian\application\admin\view\bootstrap\enterprise\index.html";i:1496932018;}*/ ?>
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2>企业信息</h2>
        <ol class="breadcrumb">
            <li>
                <a href="#">首页</a>
            </li>

            <li class="active">
                <strong>企业信息</strong>
            </li>
        </ol>
    </div>

</div>

<div class="wrapper wrapper-content animated fadeInRight ecommerce">

    <div class="ibox-content m-b-sm border-bottom" id="form1">
        <div class="row">
                        <div class="col-sm-3">
                <div class="form-group">
                    <label class="control-label" for="enterprise_name">公司名称</label>
                                        <input type="text" id="enterprise_name" name="enterprise_name" placeholder="公司名称"
                           class="form-control">
                                    </div>
            </div>

                        <div class="col-sm-3">
                <div class="form-group">
                    <label class="control-label" for="status">审核状态</label>

                            <?php echo W('parts/op',['key'=>'auth','name'=>'status']); ?>
                                    </div>
            </div>
                    </div>
        <div class="row">
            <div class="col-sm-6">
                <a class="btn btn-success btn-outline" href="#<?php echo U('form'); ?>">
                    <i class="fa fa-edit"></i>
                    <span class="bold">添加</span>
                </a>
            </div>
            <div class="col-sm-6 text-right">
                <button class="btn btn-default" data-op="reset">
                    <i class="fa fa-refresh"></i>
                    <span class="bold">重置</span>
                </button>
                &nbsp;
                &nbsp;
                <button class="btn btn-primary" data-op="search">
                    <i class="fa fa-search"></i>
                    <span class="bold">查询</span>
                </button>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <div class="ibox">
                <div class="ibox-content">
                    <table class="footable table table-stripped toggle-arrow-tiny" id="footable">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        var table = YFootTable.create('#footable', {
            baseUrl: "<?php echo U('Enterprise/'); ?>",
            searchForm: '#form1',
            columns: [
                {name:'enterprise_name',title:'公司名称',sortable: true}
				,{name:'telphone_number',title:'手机号码',sortable: true,breakpoints:'xs sm md'}
				,{name:'createtime',title:'创建时间',sortable: true,breakpoints:'xs ms md'}
				,{name:'auth__status',title:'审核状态',sortable: true,breakpoints:'xs sm md'}
				,{name:'reason',title:'原因（不通过）',sortable: true,breakpoints:'xs ms lg'}
				,{name:'account',title:'登陆账号',sortable: true,breakpoints:'xs sm lg'}
				,{name:'enterprise_contact_name',title:'公司联系人名称',sortable: true,breakpoints:'xs sm md'}
				,{name:'landline_number',title:'座机号码',sortable: true,breakpoints:'xs sm lg'}
				,{name:'email',title:'email',sortable: true,breakpoints:'xs sm lg'}
				,{name:'business_licence_img',title:'营业执照图',sortable: true,breakpoints:'xs sm lg',formatter:'image'}
				,{name:'business_licence_code',title:'营业执照编号',sortable: true,breakpoints:'xs sm lg'}
				,{name:'qq_number',title:'QQ号',sortable: true,breakpoints:'xs sm lg'}
				,{name:'contact_address',title:'联系人地址',sortable: true,breakpoints:'xs sm lg'}
				,{name:'register_address',title:'注册地址',sortable: true,breakpoints:'xs sm lg'}
				,{name:'enterprise_websit',title:'公司官网',sortable: true,breakpoints:'xs sm lg'}
				,{name:'recipient_account_number',title:'收款账号',sortable: true,breakpoints:'xs sm lg'}
				,{name:'recipient_account_bank',title:'收款账号开户行',sortable: true,breakpoints:'xs sm lg'}
				,{name:'recipient_account_name',title:'收款账号开户名',sortable: true,breakpoints:'xs sm lg'}
				,{name:'recipient_account_detail_bank',title:'收款账号支行',sortable: true,breakpoints:'xs sm lg'}
				,{name:'tax_licence_img',title:'税务登记证图片',sortable: true,breakpoints:'xs sm lg',formatter:'image'}
				,{name:'tax_licence_number',title:'税务登记证号',sortable: true,breakpoints:'xs sm lg'}
				,{name:'finance_contact_name',title:'财务联系人',sortable: true,breakpoints:'xs sm lg'}
				,{name:'finance_contact_email',title:'财务联系人邮箱',sortable: true,breakpoints:'xs sm lg'}
				,{name:'finance_contact_telphone',title:'财务联系人手机号',sortable: true,breakpoints:'xs sm lg'}
				,{name:'finance_material_address',title:'结算材料邮寄地址',sortable: true,breakpoints:'xs sm lg'}
				,{name:'password',title:'登陆密码',sortable: true,breakpoints:'xs sm lg'}
            ],
            actions: [
                {
            text:'审核',
            token:'auth',
            handler:function(row){
                if(row.status == 1){
                    YMessager.alert('已审核');
                    return;
                }
                YMessager.confirm('是否确定审核',function () {

                    c.post("<?php echo U('authEnterprise'); ?>",{id:row.id,status:1},function () {
                        table.loadData();
                    });
                });
            }
        },

        {
                    text: '拒绝',
                    token:'reject',
                    handler: function (row) {
                        swal({
                                title: "审核拒绝",
                                type: "input",
                                showCancelButton: true,
                                closeOnConfirm: false,
                                confirmButtonText: "确定",
                                cancelButtonText: '取消',
//                                animation: "slide-from-top",
                                inputPlaceholder: "在这输入理由",
                                showLoaderOnConfirm: true
                            },
                            function (inputValue) {
                                if (inputValue === false) return false;
                                if (inputValue === "") {
                                    swal.showInputError("拒绝的理由不能为空");
                                    return false
                                }
                                $.post("<?php echo U('authEnterprise'); ?>", {
                                    reason: inputValue.trim(),
                                    status: 2,
                                    id:row.id
                                }, function (rt) {
                                    debugger;
                                    if(rt.status == 1){
                                        table.loadData();
                                        YMessager.toast('操作成功');
                                    }else{
                                        YMessager.alert(rt.info);
                                    }
                                }, 'json');

                            });
                    }
                },'view', 'edit', 'remove']
        });
    });
</script>